<template>
	<view class="search">
		<view class="location" v-if="searchType == 'location'">
			<view class="icon">
				<image src="@/static/icon/search/map-icon.png" mode="widthFix"></image>
			</view>
			<view class="location_name">
				淄博
			</view>
		</view>
		<view class="search_input">
			<image class="icon" src="@/static/icon/search-icon.png" mode="widthFix"></image>
			<input class="text" type="text" v-model="search" placeholder="搜索医生、疾病、科室" />
		</view>
		<view class="search_text" v-if="searchType == 'text'" @click="searchInput">
			搜索
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				search: '',
			}
		},
		props: {
			searchType: {
				type: String,
				default: 'text'
			},
		},
		methods: {
			searchInput() {
				this.$emit('searchInput', this.search)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.search {
		padding: 20rpx 30rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;

		.location {
			flex: 0 0 15%;
			display: flex;
			align-items: center;

			.icon {
				width: 25rpx;
				height: 25rpx;
				display: flex;
				align-items: center;
				justify-content: center;

				image {
					width: 100%;
					height: 100%;
				}
			}

			.location_name {
				margin-left: 10rpx;
				font-size: 28rpx;
				color: #3B6CFE;
			}
		}

		.search_input {
			flex: 0 0 80%;
			padding: 30rpx 20rpx;
			display: flex;
			align-items: center;
			border-radius: 100rpx;
			background: rgba(238, 238, 238, 0.5);

			.icon {
				width: 24rpx;
				height: 24rpx;
				margin-right: 20rpx;

				image {
					width: 100%;
					height: 100%;
				}
			}

			input {
				width: 100%;
				font-size: 24rpx;
			}
		}

		.search_text {
			font-size: 28rpx;
			color: #3B6CFE;
			text-align: center;
		}
	}
</style>